<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a >动态举报列表</a></li>
		</ul>
        
        <form class="well form-inline margin-top-20" method="post" action="{:url('dynamicrepot/index')}">
            状态：
            <select class="form-control" name="status" style="width: 100px;">
                <option value=''>全部</option>
                <volist name="status" id="v">
                    <option value="{$key}" <if condition="input('request.status') neq '' && input('request.status') eq $key">selected</if>>{$v}</option>
                </volist>
            </select>
            提交时间：
            <input class="form-control js-bootstrap-date" name="start_time" id="start_time" value="{:input('request.start_time')}" aria-invalid="false" style="width: 110px;"> - 
            <input class="form-control js-bootstrap-date" name="end_time" id="end_time" value="{:input('request.end_time')}" aria-invalid="false" style="width: 110px;">
            举报用户ID：
            <input class="form-control" type="text" name="uid" style="width: 200px;" value="{:input('request.uid')}"
                   placeholder="举报用户ID">
            被举报用户ID：
            <input class="form-control" type="text" name="touid" style="width: 200px;" value="{:input('request.touid')}"
                   placeholder="被举报用户ID">
            动态ID：
            <input class="form-control" type="text" name="dynamicid" style="width: 200px;" value="{:input('request.dynamicid')}"
                   placeholder="动态ID">
            <input type="submit" class="btn btn-primary" value="搜索"/>
            <a class="btn btn-danger" href="{:url('dynamicrepot/index')}">清空</a>
        </form>
    
		<form method="post" class="js-ajax-form">
			<table class="table table-hover table-bordered">
				<thead>
					<tr>
						<th>举报用户</th>
						<th>被举报用户</th>
						<th>动态ID</th>
						<th width="50%">内容</th>
						<th>状态</th>
						<th>提交时间</th>
						<th align="center">{:lang('ACTIONS')}</th>
					</tr>
				</thead>
				<tbody>
					<foreach name="list" item="vo">
					<tr>
						<td>{$vo['userinfo']['user_nickname']} ({$vo['uid']})</td>
						<td>{$vo['touserinfo']['user_nickname']} ({$vo['touid']})</td>
						<td>{$vo['dynamicid']}</td>
						<td>{$vo['content']}</td>
						<td>{$status[$vo['status']]}</td>
                        <td>{:date('Y-m-d H:i',$vo['addtime'])}</td>
						<td>
                            <if condition="$vo['status'] eq 0">
                                <a class="btn btn-xs btn-success setstatus js-ajax-dialog-btn" href="{:url('dynamicrepot/setstatus',array('id'=>$vo['id'],'status'=>1))}">标记处理</a>
                            </if>
                            
                            <a class="btn btn-xs btn-warning view" data-id="{$vo['dynamicid']}">查看动态</a>
                            
                            <if condition="$vo['isdel'] eq 1">
                                <a class="btn btn-xs btn-warning " data-id="{$vo['dynamicid']}">已下架</a>
                                
                            <else />
                                <a class="btn btn-xs btn-warning xiajia" data-id="{$vo['dynamicid']}">下架动态</a>
                            </if>
                            <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('dynamicrepot/del',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
						</td>
					</tr>
					</foreach>
				</tbody>
			</table>
			<div class="pagination">{$page}</div>

		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
    <script>
    (function(){
        Wind.use('layer');
        $('.xiajia').click(function(){
            var _this=$(this);
            var id=_this.data('id');
            
            layer.prompt({
                formType: 2,
                title: '请输入下架原因',
                value: '',
                area: ['800px', '100px'] //自定义文本域宽高
            }, function(value, index, elem){
                $.ajax({
                    url:'{:url('Dynamic/setDel')}',
                    type:'POST',
                    data:{id:id,isdel:1,reason:value},
                    dataType:'json',
                    success:function(data){
                        var code=data.code;
                        if(code==0){
                            layer.msg(data.msg);
                            return !1;
                        }
                        layer.msg(data.msg,{},function(){
                            layer.closeAll();
                            reloadPage(window);
                        });
                        
                    },
                    error:function(){
                        layer.msg('操作失败，请重试')
                    }
                });
                
            });
            
        })
        
        $('.view').click(function(){
            var _this=$(this);
            var id=_this.data('id');

            layer.open({
                type: 2,
                title: '查看',
                shadeClose: true,
                shade: 0.8,
                area: ['500px', '100%'],
                content: '/admin/Dynamic/see?id='+id
            }); 
            
        });
    })()
    </script>
</body>
</html>